package leetcode_day._2021._202105._0110;

/**
 * @author yzh
 * @version 1.0
 * @date 2021/5/7 8:53
 * 数组异或操作
 * 算法：位运算
 */
public class _07_1486 {
    public static void main(String[] args) {
        System.out.println(new _07_1486().xorOperation(5, 0));
    }

    public int xorOperation(int n, int start) {
        int ans = 0;
        for (int i = 0; i < n; i++) {
            int tmp = start + 2 * i;
            ans = ans ^ tmp;
        }
        return ans;
    }
}
